import axios from 'axios';
axios.interceptors.request.use(config => {
    // 前端每次发起接口都要添加一个token
    const token = window.localStorage.getItem('token')
    if (token) {
        config.headers.authorization = "Bearer " + token;
    }
    return {
        ...config
    }
})

axios.interceptors.response.use(response => {
    return response.data
})

export default axios;